-- list-style table constructor
-- {value1, value2, ...}
-- index is integer and start from 1
days = {
	"Sunday",
	"Monday",
	"Tuesday",
	"Wednesday",
	"Thursday",
	"Friday",
	"Saturday"
}

for key, value in ipairs(days) do
	print(key .. " " .. value)
end

print(days[1])
print(days[2])

-- record-style table constructor
-- {key1=value1, key2=value2, ...}
-- the key's name must to be a valid identifier, not a string or number
complex = {real = 20, imag = -10}
-- table.x is equal to table["x"]
print("real part: " .. complex.real)
print("imag part: " .. complex["imag"])

-- general table constructor
-- use the square bracket [] to explicitly specify the table indices
-- {[key1] = value1, [key2] = value2, ...}
table = {["123"] = 456, ["+"] = "add"}
print(table["123"])
print(table["+"])
table["-"] = "sub"
print(table["-"])
